<?php

/**
 *
 *	@author Joshgeng <[<pengqiao.geng@zhaopin.com.cn>]>
 *	@date(2017.9.2) 创建
 * 
 */
class frame_model extends CI_Model{

	function __construct()
	{
		$this->load->helper('date');
		$this->load->library('session');
		$this->load->database();
	}

	/**
	 * 获取所有的用户列表
	 * @param  [type] $inputs [description]
	 * @return [type]         [description]
	 */
	function frame_list()
	{
		$session =  $this->session->userdata('username');
		$this->db->select('ZL_USER_GROUPID');
		$this->db->where('ZL_USER_NAME',$session);
		$zl_users = $this->db->get('zl_users');
		if ($zl_users->num_rows()<=0) {
			return  array('status' => -1);
		}

		$this->db->select('ZL_POWER_POWERID id');
		$this->db->from('zl_power a');
		$this->db->join('zl_power_group_list b','b.ZL_POWER_GROUP_LIST_POWERID = a.ZL_POWER_ID','left');
		$this->db->where('ZL_POWER_GROUP_LIST_GROUPID',$zl_users->row()->ZL_USER_GROUPID);
		$this->db->like('ZL_POWER_POWERID', '000', 'before');
		$zl_power = $this->db->get();
		if ($zl_power->num_rows()<=0) {
			return  array('status' => -2);
		}

		return array(
			'status' => 1,
			'data' => $zl_power->result_array()
		);
	}
}

?>
